<?php
//You will need to update this for every file that uses the sidemenu display.
GLOBAL $CFG;
require_once($CFG->libdir.'/pagelib.php');
require_once($CFG->dirroot.'/course/lib.php'); // needed for some blocks

define('PAGE_REFWORKS_VIEW',   'mod-refworks-view');
define('PAGE_REFWORKS_VIEWREFS',   'mod-refworks-viewrefs');
define('PAGE_REFWORKS_INDEX',   'mod-refworks-index');
define('PAGE_REFWORKS_CREATEBIB',   'mod-refworks-createbib');
define('PAGE_REFWORKS_IMPORTREFS',   'mod-refworks-importrefs');
define('PAGE_REFWORKS_EXPORTREFS',   'mod-refworks-exportrefs');
define('PAGE_REFWORKS_MOVEREF',   'mod-refworks-moveref');
define('PAGE_REFWORKS_VIEWFOLDER',   'mod-refworks-viewfolder');
define('PAGE_REFWORKS_CREATEFOLDER',   'mod-refworks-createfolder');
define('PAGE_REFWORKS_REMOVEREF',   'mod-refworks-removeref');
define('PAGE_REFWORKS_MANAGEFOLDERS',   'mod-refworks-managefolders');
define('PAGE_REFWORKS_MANAGEREFS',   'mod-refworks-managerefs');
define('PAGE_REFWORKS_CREATEREF',	'mod-refworks-createref');
define('PAGE_REFWORKS_SHAREFOLDERS',   'mod-refworks-sharefolders');
define('PAGE_REFWORKS_COLLAB_LOGIN',   'mod-refworks-collab-collab_login');
define('PAGE_REFWORKS_COLLAB_LOGOUT',   'mod-refworks-collab-collab_logout');
define('PAGE_REFWORKS_COLLAB_CREATE',   'mod-refworks-collab-collab_create');
define('PAGE_REFWORKS_COLLAB_MANAGE_USERS',   'mod-refworks-collab-collab_manage_users');
define('PAGE_REFWORKS_COLLAB_MANAGE',   'mod-refworks-collab-collab_manage');
define('PAGE_REFWORKS_REPORT',   'mod-refworks-reports-report');

page_map_class(PAGE_REFWORKS_VIEW, 'page_refworks');
page_map_class(PAGE_REFWORKS_VIEWREFS, 'page_refworks');
page_map_class(PAGE_REFWORKS_INDEX, 'page_refworks');
page_map_class(PAGE_REFWORKS_CREATEBIB, 'page_refworks');
page_map_class(PAGE_REFWORKS_IMPORTREFS, 'page_refworks');
page_map_class(PAGE_REFWORKS_EXPORTREFS, 'page_refworks');
page_map_class(PAGE_REFWORKS_MOVEREF, 'page_refworks');
page_map_class(PAGE_REFWORKS_VIEWFOLDER, 'page_refworks');
page_map_class(PAGE_REFWORKS_CREATEFOLDER, 'page_refworks');
page_map_class(PAGE_REFWORKS_REMOVEREF, 'page_refworks');
page_map_class(PAGE_REFWORKS_MANAGEFOLDERS, 'page_refworks');
page_map_class(PAGE_REFWORKS_MANAGEREFS, 'page_refworks');
page_map_class(PAGE_REFWORKS_CREATEREF, 'page_refworks');
page_map_class(PAGE_REFWORKS_SHAREFOLDERS, 'page_refworks');
page_map_class(PAGE_REFWORKS_COLLAB_LOGIN, 'page_refworks');
page_map_class(PAGE_REFWORKS_COLLAB_LOGOUT, 'page_refworks');
page_map_class(PAGE_REFWORKS_COLLAB_CREATE, 'page_refworks');
page_map_class(PAGE_REFWORKS_COLLAB_MANAGE_USERS, 'page_refworks');
page_map_class(PAGE_REFWORKS_COLLAB_MANAGE, 'page_refworks');
page_map_class(PAGE_REFWORKS_REPORT, 'page_refworks');

$DEFINEDPAGES = array(PAGE_REFWORKS_VIEW, PAGE_REFWORKS_VIEWREFS, PAGE_REFWORKS_INDEX, PAGE_REFWORKS_CREATEREF, PAGE_REFWORKS_IMPORTREFS, PAGE_REFWORKS_EXPORTREFS, PAGE_REFWORKS_CREATEBIB, PAGE_REFWORKS_MOVEREF, PAGE_REFWORKS_VIEWFOLDER, PAGE_REFWORKS_CREATEFOLDER, PAGE_REFWORKS_MANAGEFOLDERS, PAGE_REFWORKS_REMOVEREF, PAGE_REFWORKS_MANAGEREFS, PAGE_REFWORKS_COLLAB_LOGIN, PAGE_REFWORKS_COLLAB_LOGOUT, PAGE_REFWORKS_COLLAB_CREATE, PAGE_REFWORKS_COLLAB_MANAGE_USERS, PAGE_REFWORKS_SHAREFOLDERS, PAGE_REFWORKS_COLLAB_MANAGE, PAGE_REFWORKS_REPORT);


class page_refworks extends page_generic_activity {

    var $navblockinstance = NULL;

    function init_quick($data) {
        if(empty($data->pageid)) {
            error('Cannot quickly initialize page: empty course id');
        }
        $this->activityname = 'refworks';
        parent::init_quick($data);
    }
  
    function get_type() {
        switch($this->body_id){
            case 'mod-refworks-view':
                return PAGE_REFWORKS_VIEW;
            break;
            case 'mod-refworks-viewrefs':
                return PAGE_REFWORKS_VIEWREFS;
            break;
            case 'mod-refworks-index':
                return PAGE_REFWORKS_INDEX;
            break;
            case 'mod-refworks-exportrefs':
                return PAGE_REFWORKS_EXPORTREFS;
            break;
            case 'mod-refworks-importrefs':
                return PAGE_REFWORKS_IMPORTREFS;
            break;
            case 'mod-refworks-createbib':
                return PAGE_REFWORKS_CREATEBIB;
            break;
            case 'mod-refworks-moveref':
                return PAGE_REFWORKS_MOVEREF;
            break;
            case 'mod-refworks-viewfolder':
                return PAGE_REFWORKS_VIEWFOLDER;
            break;
            case 'mod-refworks-createfolder':
                return PAGE_REFWORKS_CREATEFOLDER;
            break;
            case 'mod-refworks-removeref':
                return PAGE_REFWORKS_REMOVEREF;
            break;
            case 'mod-refworks-managefolders':
                return PAGE_REFWORKS_MANAGEFOLDERS;
            break;
            case 'mod-refworks-managerefs':
                return PAGE_REFWORKS_MANAGEREFS;
            break;
            case 'mod-refworks-createref':
                return PAGE_REFWORKS_CREATEREF;
            break;
            case 'mod-refworks-sharefolders':
                return PAGE_REFWORKS_SHAREFOLDERS;
            break;
            case 'mod-refworks-collab-collab_login':
                return PAGE_REFWORKS_COLLAB_LOGIN;
            break;
            case 'mod-refworks-collab-collab_logout':
                return PAGE_REFWORKS_COLLAB_LOGOUT;
            break;
            case 'mod-refworks-collab-collab_create':
                return PAGE_REFWORKS_COLLAB_CREATE;
            break;
            case 'mod-refworks-collab-collab_manage_users':
                return PAGE_REFWORKS_COLLAB_MANAGE_USERS;
            break;
            case 'mod-refworks-collab-collab_manage':
                return PAGE_REFWORKS_COLLAB_MANAGE;
            break;
            case 'mod-refworks-reports-report':
                return PAGE_REFWORKS_REPORT;
            break;
        }
        
    }
}

?>
